// import React,{ Component } from 'react'
// import { connect } from 'react-redux'
// import { bindActionCreators } from 'redux'
// import actions from '@/actions'
// import List from './list/List'

//  class Hot extends Component{

//     componentDidMount(){
//         this.props.getHotMovies()
//     }

//     render(){
//         const { hot_movies } = this.props
//         return(
//             <List hot_movies = { hot_movies }/>
//         //     <ul className="mv-list">
//         //     <li>
//         //         <img src="http://p0.meituan.net/100.100/moviemachine/58ee13be6dc60bf5e636cf915bbbaaa55787785.jpg" alt=""/>
//         //         <div className='mv-details'>
//         //             <h3>冰雪奇缘2</h3>
//         //             <p>观众评</p><span className="score">9.0</span>
//         //             <p>主演：克里斯汀·贝尔,伊迪娜·门泽尔,乔纳森·格罗夫</p>
//         //             <p>今天333家影院放映6238场</p>
//         //             <span className="buy">购票</span>
//         //         </div>
                
//         //     </li>
//         //     <li>
//         //         <img src="http://p0.meituan.net/100.100/moviemachine/58ee13be6dc60bf5e636cf915bbbaaa55787785.jpg" alt=""/>
//         //         <div className='mv-details'>
//         //             <h3>冰雪奇缘2</h3>
//         //             <p>观众评</p><span className="score">9.0</span>
//         //             <p>主演：克里斯汀·贝尔,伊迪娜·门泽尔,乔纳森·格罗夫</p>
//         //             <p>今天333家影院放映6238场</p>
//         //             <span className="buy">购票</span>
//         //         </div>
                
//         //     </li>
//         // </ul>
//         )
//     }
// }

// const mapStateFromProps = state => {
//     return state.homeModule
// }

// const mapDispatchFromProps = dispatch => {
//     return bindActionCreators( actions,dispatch )
// }

// export default connect( mapStateFromProps,mapDispatchFromProps )(Hot)

import React,{ Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import actions from '@/actions'
import List from './list/List'
import BScroll from 'better-scroll'



class Hot extends Component{

    componentDidMount() {
        this.props.getHotMovies()
        this.bscroll = new BScroll('.wrapper',{
            click:true,
            pullUpLoad:{
                threshold:50
            }
        })
        this.bscroll.on('pullingUp',() => {
            console.log('up')
            this.bscroll.finishPullUp()

        })
    }

    render(){
        const {hot_movies} = this.props 
        return(
            <div
            style = {{
                flex: 1,
                overflow: 'auto',
                height: '100%'
              }}
            className='wrapper'>
                <List hot_movies = { hot_movies }/>
            </div>
        )
    }
}


const mapStateFromProps = state => {
    return{
        hot_movies:state.homeReducer.hot_movies
    }
}

const mapDispatchFromProps = dispatch => {
    return bindActionCreators( actions('home'),dispatch )
}

export default connect( mapStateFromProps,mapDispatchFromProps )(Hot)